//
//  FormCellView.h
//  etionUI
//
//  Created by wangjian on 12/23/13.
//  Copyright (c) 2013 GuangZhouXuanWu. All rights reserved.
//

#import <UIKit/UIKit.h>

#define DEF_FORM_CELL_FONT_SIZE 13
#define FORMVIEW_CELL_MARGIN_X 9
#define FORMVIEW_CELL_MARGIN_Y 9
#define FORMVIEW_CELL_IMAGE_MARGIN 6

typedef enum
{
    EFormBorderNone     = 0,
    EFormBorderLeft     = 1 << 0,
    EFormBorderTop      = 1 << 1,
    EFormBorderRight    = 1 << 2,
    EFormBorderBottom   = 1 << 3
} EFormBorderMask;

@interface CFormCellIndex : NSObject <NSCopying>

+ (CFormCellIndex *)indexWithtRow:(NSUInteger)row col:(NSUInteger)col;
- (id)initWithtRow:(NSUInteger)row col:(NSUInteger)col;
- (BOOL)isEqualToIndex:(CFormCellIndex *)index;

@property (nonatomic, assign) NSUInteger row;
@property (nonatomic, assign) NSUInteger col;

@end

/**
 *  基础form cell，默认有一个textLable
 */

@interface CFormCellView : UIView

@property (nonatomic, readonly) UILabel *textLable;
@property (nonatomic, readonly) UIImageView *iconView;

@property (nonatomic, assign) BOOL selectable;
@property (nonatomic, assign) BOOL selected;
@property (nonatomic, assign) BOOL highlightable;   //仅当selectable == YES时有效，表示被选中时，是否高亮显示

@property (nonatomic, readonly, copy) NSString *reuseIdentifier;

@property (nonatomic, assign) BOOL isFocus;
@property (nonatomic, assign) CGFloat borderSize;
@property (nonatomic, retain) UIColor *borderColor;
@property (nonatomic, assign) EFormBorderMask borderMask;
@property (nonatomic, retain) UIView *selectedBackgroundView;
@property (nonatomic, retain) UIColor *selectedBackgroundColor;

//以下为方便计算单元格大小，或者字符串显示大小的方便函数
+ (CGSize)textLabelSizeWithCellSize:(CGSize)cellSize;
+ (CGSize)textLabelSizeWithCellSize:(CGSize)cellSize iconSize:(CGSize)iconSize;
+ (CGSize)cellSizeWithTextSize:(CGSize)textSize;
+ (CGSize)cellSizeWithTextSize:(CGSize)textSize iconSize:(CGSize)iconSize;

- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier;
//- (void)prepareForReuse;

- (void)setSelectedState:(BOOL)bSelected animated:(BOOL)animated;

@end

@interface CFormTextInputCellView : CFormCellView

//编辑外框颜色
@property (nonatomic, retain) UIColor *editFrameColor;

@end

@interface CFormLinkCellView : CFormCellView

@property (nonatomic, assign) NSString *text;
@property (nonatomic, assign) BOOL hasClicked;

@end

@interface CFormSelectorCellView : CFormCellView

@property (nonatomic, assign) BOOL unique;
@property (nonatomic, assign) BOOL chosed;

@end

@interface CFormImageCellView : CFormCellView

@property (nonatomic, readonly) UIImageView *imageView;

@end

@interface CFormDropDownCellView : CFormCellView

@end

@interface CFormCallCellView : CFormCellView

@end

//用于必填项的显示(*)
@interface CFormMarkCellView : CFormCellView

- (void)hideMark:(BOOL)bShow;

@end